#include "testlib.h"
#include <bits/stdc++.h>

#define forn(i, n) for (int i = 0; i < int(n); i++)

using namespace std;

int main(int argc, char* argv[])
{
    registerGen(argc, argv, 1);

    int n = opt<int>(1);
    int t = opt<int>(3);
    int q = opt<int>(2);
    int v = opt<int>(4);

    vector<int> p(n), a(n);
    forn(i, n)
        p[i] = rnd.next(1, v);

    forn(i, n)
        a[i] = p[rnd.wnext(n, t)];
    
    println(n);
    println(a);
    println(q);
    for(int i = 1, l, r, L, R; i <= q; i ++) {
        l = rnd.wnext(1, n, q / 2 - i), r = rnd.next(l, n);
        L = rnd.next(2) ? l : rnd.wnext(1, n, q / 2 - i), R = rnd.next(L, n);
        l = r - l + 1;
        L = R - L + 1;
        println(l, r, L, R);
    }
    return 0;
}